package com.smf.lsc.authorization.security.service;

import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;

/**
 * 登录用户信息装载
 * Created on 2021/11/19.
 *
 * @author ln
 * @since 1.0
 */
@Component
public class MyUserDetailsService implements UserDetailsService {

//    @Autowired
//    private PasswordEncoder passwordEncoder;

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {

    	//装载自定义用户信息
    	MyUserDetails user=new MyUserDetails();
    	user.setAccount(username);
    	user.setUserName("lsc管理员");
    	user.setUnitId("456");
    	user.setUnitName("测试机构");
    	return user;
    	
    	//默认用户信息装载
//    	String password=passwordEncoder.encode("BECB5504E0CA886D005B11F68C7ECDC8");
//      return new User(username, password, AuthorityUtils.commaSeparatedStringToAuthorityList("ROLE_USER"));
    }
}
